﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Skugo.StandardPlugins
{
    /// <summary>
    /// Interaction logic for TagUIElement.xaml
    /// </summary>
    public partial class TagUIElement : UserControl
    {
        private CommandManager Manager;
        private CommandSearch Search;

        public TagUIElement(CommandManager manager, CommandSearch search)
        {
            InitializeComponent();

            this.Manager = manager;
            this.Search = search;
        }

        private void Commands_KeyDown(object sender, KeyEventArgs e)
        {
            var element = (CommandUIElement)this.Commands.SelectedItem;
            this.Manager.ExecuteRemoteCommand(element.Source.Name);
            this.Search.Close();
        }
    }
}
